# -*- coding: utf-8 -*-
# @Time    : 2024/9/5 下午4:26
# @Author  : liujun
# @Email   : 2592730854@qq.com
# @File    : home_page.py
# @Software: PyCharm


from appium.webdriver.common.appiumby import AppiumBy as By

class HomePage:
    """主页面（进入APP的界面）"""

    #课堂
    class_locator=(By.XPATH,"//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/androidx.drawerlayout.widget.DrawerLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.TabHost[1]/android.widget.LinearLayout[1]/android.widget.TabWidget[1]/android.widget.RelativeLayout[2]/android.widget.LinearLayout[1]/android.widget.ImageView[1]")
    #发布
    release_locator=(By.ID,"com.xiachufang:id/tab_widget_content_create")
    #收藏
    collections_locator=(By.XPATH,"//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/androidx.drawerlayout.widget.DrawerLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.TabHost[1]/android.widget.LinearLayout[1]/android.widget.TabWidget[1]/android.widget.RelativeLayout[3]/android.widget.LinearLayout[1]/android.widget.ImageView[1]")

    def __init__(self,driver):
        self.driver = driver

    def click_class(self):  #点击课堂
        self.driver.find_element(*self.class_locator).click()

    def click_release(self):  #点击发布按钮
        self.driver.find_element(*self.release_locator).click()

    def click_collections(self): #点击收藏
        self.driver.find_element(*self.collections_locator).click()






